package com.peakmain.wanandroid.netmodule.utils;

import android.content.Context;

import com.andview.refreshview.XRefreshView;
import com.peakmain.baselibrary.widget.XRefreshViewNewFooter;
import com.peakmain.baselibrary.widget.XRefreshViewNewHeader;

/**
 * author ：Peakmain
 * createTime：2019/7/14
 * mail:2726449200@qq.com
 * describe：
 */
public class XRefreshUtils {

    private XRefreshUtils(){

    }
    private static class Holder{
        private static final XRefreshUtils instance=new XRefreshUtils();
    }
    public static XRefreshUtils getInstance(){
        return Holder.instance;
    }
    public void initXRefresh(XRefreshView xRefreshView, Context context){
        xRefreshView.setPullLoadEnable(true);
        XRefreshViewNewHeader xRefreshViewNewHeader = new XRefreshViewNewHeader(context);
        xRefreshView.setCustomHeaderView(xRefreshViewNewHeader);
        XRefreshViewNewFooter xRefreshViewNewFooter=new XRefreshViewNewFooter(context);
        xRefreshView.setCustomFooterView(xRefreshViewNewFooter);
        //设置是否可以上拉加载
        xRefreshView.setPullLoadEnable(true);
        xRefreshView.setMoveForHorizontal(true);
        //xRefreshView.setAutoLoadMore(false);
        xRefreshView.setPinnedTime(1000);

    }
}
